package com.youku.plugins.controlbarV4.view.components
{
   import flash.display.Sprite;
   import com.youku.interfaces.ISkinChangeCompent;
   import flash.display.MovieClip;
   import com.youku.baseUI.BasePlayerButton;
   import flash.utils.Dictionary;
   import flash.utils.Timer;
   import com.youku.utils.AssetUtil;
   import flash.events.TimerEvent;
   import flash.events.MouseEvent;
   import com.youku.plugins.controlbarV4.view.events.ProgressBarEvent;
   import com.youku.plugins.controlbarV4.ControlBarConstant;
   import flash.geom.Rectangle;
   import com.youku.utils.ReportUtil;
   import com.youku.utils.BaseUtil;
   import flash.geom.ColorTransform;
   import flash.display.DisplayObject;
   import com.youku.utils.Tweener;
   import com.youku.PlayerConfig;
   import com.youku.skin.PartenerSkinManager;
   
   public class ProgressBar extends Sprite implements ISkinChangeCompent
   {
      
      public function ProgressBar() {
         super();
         this._loadPer = 0;
         this._playPer = 0;
         this._tempPer = 0;
         this._hoding = false;
         this._dragging = false;
         this._animate = false;
         this._enabled = true;
         this._enablePreview = true;
         this.totalTime = 0;
         this._headPosition = -1;
         this._tailPosition = -1;
         this._storyPoints = new Array();
         this._storyPointData = new Array();
         this._storyPointDict = new Dictionary();
         this._interactPoints = new Array();
         this._interactPointData = new Array();
         this._startDragTime = 0;
         PartenerSkinManager.push(this);
      }
      
      private var _width:Number;
      
      private var _height:Number;
      
      private var _base:Sprite;
      
      private var _unloadBar:MovieClip;
      
      private var _loadedBar:MovieClip;
      
      private var _redBar:MovieClip;
      
      private var _loadedBar_bg:MovieClip;
      
      private var _redBar_bg:MovieClip;
      
      private var _ball:Sprite;
      
      private var _ballBtn:BasePlayerButton;
      
      private var _lineLayer:Sprite;
      
      private var _adPoints:Array;
      
      private var _adLines:Array;
      
      private var _headPoint:JumpPoint;
      
      private var _tailPoint:JumpPoint;
      
      private var _headPosition:Number;
      
      private var _tailPosition:Number;
      
      private var _storyPoints:Array;
      
      private var _storyPointData:Array;
      
      private var _storyPointDict:Dictionary;
      
      private var _interactPoints:Array;
      
      private var _interactPointData:Array;
      
      private var _pointLayer:Sprite;
      
      private var _dragW:Number;
      
      private var _hoding:Boolean;
      
      private var _loadPer:Number;
      
      private var _playPer:Number;
      
      private var _tempPer:Number;
      
      private var _dragging:Boolean;
      
      private var _animate:Boolean;
      
      private var _enabled:Boolean;
      
      private var _enablePreview:Boolean = true;
      
      private var _previewer:Previewer;
      
      private const SHOW_PREVIEWER_TIMEOUT:Number = 2000.0;
      
      private var _showPreviewerTimer:Timer;
      
      private var _lastPreviewTime:Number = 0;
      
      private var _lastPreviewX:Number = 0;
      
      private var _isShowingPreview:Boolean = false;
      
      private var _startDragTime:Number = 0;
      
      private var _shouldShowPoint:Boolean = true;
      
      public var totalTime:Number;
      
      private var _isImagePreview:Boolean;
      
      private var _mode:String;
      
      private var _winType:String = "interior";
      
      public function init(param1:Number, param2:Number) : void {
         this._width = param1;
         this._height = param2;
         this._adPoints = [];
         this._adLines = [];
         this.createItems();
         this.addEvents();
      }
      
      private function createItems() : void {
         this._previewer = new Previewer();
         this.addChild(this._previewer);
         this._previewer.buttonMode = true;
         this._previewer.useHandCursor = true;
         this._base = new Sprite();
         this.addChild(this._base);
         this._lineLayer = new Sprite();
         this._unloadBar = AssetUtil.getAsset("C_Slider_bar_grey") as MovieClip;
         this._loadedBar = AssetUtil.getAsset("C_Slider_bar_buff") as MovieClip;
         this._redBar = AssetUtil.getAsset("C_Slider_bar_red") as MovieClip;
         this._redBar_bg = AssetUtil.getAsset("C_Slider_bar_red") as MovieClip;
         this._loadedBar_bg = AssetUtil.getAsset("C_Slider_bar_buff") as MovieClip;
         this._ball = new Sprite();
         this._ballBtn = AssetUtil.getStyleButton("C_Slider_ball");
         AssetUtil.restoreButtonSize(this._ballBtn);
         this._ballBtn.x = -this._ballBtn.width / 2;
         this._ballBtn.y = -this._ballBtn.height / 2;
         this._headPoint = new JumpPoint();
         this._tailPoint = new JumpPoint();
         this._lineLayer.buttonMode = true;
         this._lineLayer.useHandCursor = true;
         this._pointLayer = new Sprite();
         this._base.addChild(this._lineLayer);
         this._lineLayer.addChild(this._unloadBar);
         this._lineLayer.addChild(this._loadedBar_bg);
         this._lineLayer.addChild(this._redBar_bg);
         this._lineLayer.addChild(this._loadedBar);
         this._lineLayer.addChild(this._redBar);
         this._base.addChild(this._pointLayer);
         this._base.addChild(this._ball);
         this._ball.addChild(this._ballBtn);
         this._ball.y = -this._redBar.height / 2;
         this._unloadBar.width = this._width;
         this._loadedBar.width = 0;
         this._redBar.width = 0;
         this._loadedBar.x = this._ball.width / 2;
         this._redBar.x = this._loadedBar.x;
         this._redBar_bg.x = 0;
         this._redBar_bg.width = this._redBar.x + 1;
         this._loadedBar_bg.width = this._redBar_bg.width;
         this._loadedBar_bg.x = this._width - this._loadedBar_bg.width;
         this._loadedBar_bg.visible = false;
         this._ball.x = this._ball.width / 2;
         this._dragW = this._width - this._ball.width;
         this._showPreviewerTimer = new Timer(this.SHOW_PREVIEWER_TIMEOUT);
         this._showPreviewerTimer.addEventListener(TimerEvent.TIMER,this.onShowPreviewTimeOut);
      }
      
      private function addEvents() : void {
         this._ball.addEventListener(MouseEvent.MOUSE_DOWN,this.onSliderMouseDown);
         this._lineLayer.addEventListener(MouseEvent.MOUSE_DOWN,this.onLoadBarMouseDown);
         this.globalEvent = false;
         this._ball.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
         this._lineLayer.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
         this._headPoint.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
         this._tailPoint.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
         this._headPoint.addEventListener(MouseEvent.CLICK,this.onHeadEvent);
         this._tailPoint.addEventListener(MouseEvent.CLICK,this.onTailEvent);
      }
      
      private function set globalEvent(param1:Boolean) : void {
         var _loc2_:* = 0;
         var _loc3_:* = 0;
         var _loc4_:JumpPoint = null;
         var _loc5_:JumpPoint = null;
         var _loc6_:* = 0;
         var _loc7_:* = 0;
         var _loc8_:JumpPoint = null;
         var _loc9_:JumpPoint = null;
         if(param1)
         {
            this.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._ball.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._lineLayer.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._ball.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._lineLayer.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._headPoint.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._headPoint.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._tailPoint.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._tailPoint.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            _loc2_ = 0;
            while(_loc2_ < this._storyPoints.length)
            {
               _loc4_ = this._storyPoints[_loc2_] as JumpPoint;
               _loc4_.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
               _loc4_.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
               _loc2_++;
            }
            _loc3_ = 0;
            while(_loc3_ < this._interactPoints.length)
            {
               _loc5_ = this._interactPoints[_loc3_] as JumpPoint;
               _loc5_.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
               _loc5_.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
               _loc3_++;
            }
         }
         else
         {
            this.removeEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this.removeEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._ball.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._lineLayer.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._ball.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._lineLayer.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._headPoint.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._headPoint.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            this._tailPoint.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
            this._tailPoint.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
            _loc6_ = 0;
            while(_loc6_ < this._storyPoints.length)
            {
               _loc8_ = this._storyPoints[_loc6_] as JumpPoint;
               _loc8_.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
               _loc8_.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
               _loc6_++;
            }
            _loc7_ = 0;
            while(_loc7_ < this._interactPoints.length)
            {
               _loc9_ = this._interactPoints[_loc7_] as JumpPoint;
               _loc9_.addEventListener(MouseEvent.ROLL_OVER,this.onThisRollOver);
               _loc9_.addEventListener(MouseEvent.ROLL_OUT,this.onThisRollOut);
               _loc7_++;
            }
         }
      }
      
      private function onBallRollOut(param1:MouseEvent) : void {
         while(this._ball.numChildren > 0)
         {
            this._ball.removeChildAt(0);
         }
         this._ball.addChild(AssetUtil.getAsset("C_Slider_ball_up") as MovieClip);
      }
      
      private function onBallRollOver(param1:MouseEvent) : void {
         while(this._ball.numChildren > 0)
         {
            this._ball.removeChildAt(0);
         }
         this._ball.addChild(AssetUtil.getAsset("C_Slider_ball_over") as MovieClip);
      }
      
      private function onSliderMouseDown(param1:MouseEvent) : void {
         if(!this._enabled)
         {
            return;
         }
         this._dragging = false;
         this._hoding = true;
         var _loc2_:Number = Math.round((this._ball.x - this._ball.width / 2) / this._dragW * this.totalTime);
         var _loc3_:ProgressBarEvent = new ProgressBarEvent(ProgressBarEvent.DRAG_BEGIN,{"time":_loc2_});
         this.dispatchEvent(_loc3_);
         this._startDragTime = _loc2_;
         var _loc4_:Number = this._mode == ControlBarConstant.PROGRESSBAR_MODE_MINI_SHOW_BALL?-this._lineLayer.height / 2:-this._redBar.height / 2;
         this._ball.startDrag(false,new Rectangle(this._ball.width / 2,_loc4_,this._width - this._ball.width,0));
         stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onStageMouseMove);
         stage.addEventListener(MouseEvent.MOUSE_UP,this.onStageMouseUp);
      }
      
      private function onLoadBarMouseDown(param1:MouseEvent) : void {
         if(!this._enabled)
         {
            return;
         }
         this._dragging = false;
         this._hoding = true;
         var _loc2_:Number = Math.round((this._ball.x - this._ball.width / 2) / this._dragW * this.totalTime);
         var _loc3_:ProgressBarEvent = new ProgressBarEvent(ProgressBarEvent.DRAG_BEGIN,{"time":_loc2_});
         this.dispatchEvent(_loc3_);
         this._startDragTime = _loc2_;
         this.setSlidePx();
         var _loc4_:Number = this._mode == ControlBarConstant.PROGRESSBAR_MODE_MINI_SHOW_BALL?-this._lineLayer.height / 2:-this._redBar.height / 2;
         this._ball.startDrag(false,new Rectangle(this._ball.width / 2,_loc4_,this._width - this._ball.width,0));
         stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onStageMouseMove);
         stage.addEventListener(MouseEvent.MOUSE_UP,this.onStageMouseUp);
      }
      
      private function onStageMouseMove(param1:MouseEvent) : void {
         this._dragging = true;
         this._redBar.width = this._ball.x - this._ball.width / 2;
         var _loc2_:Number = this._ball.x - this._ball.width / 2;
         if(_loc2_ > this._dragW)
         {
            _loc2_ = this._dragW;
         }
         if(_loc2_ < 0)
         {
            _loc2_ = 0;
         }
         var _loc3_:Number = Math.round(_loc2_ / this._dragW * this.totalTime);
         var _loc4_:ProgressBarEvent = new ProgressBarEvent(ProgressBarEvent.DRAGGING,{"time":_loc3_});
         this.dispatchEvent(_loc4_);
         _loc4_ = null;
      }
      
      private function onStageMouseUp(param1:MouseEvent) : void {
         stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onStageMouseMove);
         stage.removeEventListener(MouseEvent.MOUSE_UP,this.onStageMouseUp);
         this._ball.stopDrag();
         this._hoding = false;
         this._dragging = false;
         var _loc2_:Number = Math.round((this._ball.x - this._ball.width / 2) / this._dragW * this.totalTime);
         var _loc3_:ProgressBarEvent = new ProgressBarEvent(ProgressBarEvent.DRAG_FINISH,{"time":_loc2_});
         ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_BAR_DRAG,ReportUtil.METHOD_LEFT_CLICK,
            {
               "tb":this._startDragTime,
               "to":_loc2_
            });
         this.dispatchEvent(_loc3_);
         this._tempPer = this._playPer;
         this._animate = true;
      }
      
      private function onThisRollOver(param1:MouseEvent) : void {
         dispatchEvent(new ProgressBarEvent(ProgressBarEvent.SHOW_PREVIEW_TIME));
         this._showPreviewerTimer.reset();
         this._showPreviewerTimer.start();
      }
      
      private function onThisRollOut(param1:MouseEvent) : void {
         dispatchEvent(new ProgressBarEvent(ProgressBarEvent.HIDE_PREVIEW_TIME));
         this._showPreviewerTimer.stop();
         this.globalEvent = false;
      }
      
      private function onThisMouseMove(param1:MouseEvent) : void {
         this._previewer.x = this.mouseX;
         var _loc2_:Number = param1.currentTarget == this._ball && !this._isImagePreview?-10:-4;
         this._previewer.y = _loc2_;
         var _loc3_:Number = this._hoding?this._ball.x - this._ball.width / 2:this.mouseX - this._ball.width / 2;
         this._dragW = this._width - this._ball.width;
         if(_loc3_ > this._dragW)
         {
            _loc3_ = this._dragW;
         }
         if(_loc3_ < 0)
         {
            _loc3_ = 0;
         }
         var _loc4_:Number = Math.round(_loc3_ / this._dragW * this.totalTime);
         var _loc5_:String = BaseUtil.formatTime(_loc4_);
         if(param1.currentTarget is JumpPoint)
         {
            _loc5_ = this._storyPointDict[param1.currentTarget];
         }
         if(param1.currentTarget == this._headPoint)
         {
            _loc5_ = BaseUtil.formatTime(this._headPosition) + " " + "片头";
         }
         if(param1.currentTarget == this._tailPoint)
         {
            _loc5_ = BaseUtil.formatTime(this._tailPosition) + " " + "片尾";
         }
         this._previewer.setText(_loc5_);
         if(this._isImagePreview == true)
         {
            if(this._isShowingPreview)
            {
               this.tryToShowPreviewer(true);
            }
            this._showPreviewerTimer.reset();
            this._showPreviewerTimer.start();
         }
         else if(!(_loc4_ == this._lastPreviewTime) && Math.abs(this.mouseX - this._lastPreviewX) > 5 && (this._isShowingPreview))
         {
            this._lastPreviewTime = _loc4_;
            dispatchEvent(new ProgressBarEvent(ProgressBarEvent.HIDE_PREVIEW_VIDEO));
            this._isShowingPreview = false;
            this._showPreviewerTimer.reset();
            this._showPreviewerTimer.start();
            this.globalEvent = false;
         }
         
      }
      
      private function tryToShowPreviewer(param1:Boolean = false) : void {
         if(!this._enabled || !param1 || !this._enablePreview)
         {
            return;
         }
         var _loc2_:Number = this.mouseX - this._ball.width / 2;
         this._previewer.x = this.mouseX;
         var _loc3_:Number = Math.round(_loc2_ / this._dragW * this.totalTime);
         if(this._isImagePreview == true)
         {
            this._previewer.showImage(_loc3_);
            if(this._previewer.previewMode != ControlBarConstant.PREVIEW_MODE_SMALL)
            {
               this._previewer.setSize(ControlBarConstant.PREVIEW_MODE_SMALL,this._previewer.playerWidth);
               this._previewer.previewMode = ControlBarConstant.PREVIEW_MODE_SMALL;
               this._previewer.attachEvent(true);
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_PREVIEW_IMAGE_SHOW);
               this._base.transform.colorTransform = new ColorTransform(0.65,0.65,0.65,1,89,89,89,0);
            }
         }
         else
         {
            ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_PREVIEW_VIDEO_SHOW);
            dispatchEvent(new ProgressBarEvent(ProgressBarEvent.SHOW_PREVIEW_VIDEO,{"time":_loc3_}));
         }
         this._lastPreviewX = this.mouseX;
         this._isShowingPreview = true;
         this.globalEvent = true;
      }
      
      private function onShowPreviewTimeOut(param1:TimerEvent) : void {
         this._showPreviewerTimer.stop();
         if(!this._isShowingPreview)
         {
            this.tryToShowPreviewer(true);
         }
      }
      
      private function setSlidePx() : void {
         var _loc1_:Number = this.mouseX;
         if(_loc1_ > this._dragW + this._ball.width / 2)
         {
            _loc1_ = this._dragW + this._ball.width / 2;
         }
         if(_loc1_ < this._ball.width / 2)
         {
            _loc1_ = this._ball.width / 2;
         }
         this._ball.x = _loc1_;
         this._hoding = true;
      }
      
      public function setLoadPercent(param1:Number) : void {
         if(param1 >= 1)
         {
            param1 = 1;
         }
         this._loadPer = param1;
         if(this._loadPer < this._playPer)
         {
            this._loadPer = this._playPer;
         }
         this._loadedBar_bg.visible = this._loadPer >= 1;
         var _loc2_:Number = this._dragW * this._loadPer;
         this._loadedBar.width = _loc2_;
      }
      
      public function setPlayPercent(param1:Number) : void {
         var _loc2_:* = NaN;
         var _loc3_:* = NaN;
         if(param1 >= 1)
         {
            param1 = 1;
         }
         if(!this._hoding)
         {
            this._playPer = param1;
            if((this._animate) && !(this._tempPer == this._playPer))
            {
               this._animate = false;
               this._hoding = true;
               this._hoding = false;
            }
            else
            {
               this._ball.x = this._dragW * this._playPer + this._ball.width / 2;
               _loc2_ = this._mode == ControlBarConstant.PROGRESSBAR_MODE_MINI_HIDE_BALL?this._ballBtn.width:this._ball.width;
               if(this._ball.x < _loc2_ / 2)
               {
                  this._ball.x = _loc2_ / 2;
               }
               else if(this._ball.x > this._width - _loc2_ / 2)
               {
                  this._ball.x = this._width - _loc2_ / 2;
               }
               
               _loc3_ = this._mode == ControlBarConstant.PROGRESSBAR_MODE_NORMAL?this._ball.x - this._ball.width / 2:this._dragW * this._playPer;
               this._redBar.width = _loc3_;
            }
         }
      }
      
      public function reset() : void {
         this.addADPoints(new Array());
         this._isShowingPreview = false;
         this.hidePreview();
         this._lastPreviewTime = 0;
         this._headPosition = -1;
         this._tailPosition = -1;
         this._headPoint.visible = false;
         this._tailPoint.visible = false;
         this.removeStoryPoint();
         this.removeInteractPoint();
      }
      
      private function removeStoryPoint() : void {
         var _loc2_:JumpPoint = null;
         if(this._storyPoints.length == 0)
         {
            return;
         }
         var _loc1_:* = 0;
         while(_loc1_ < this._storyPoints.length)
         {
            _loc2_ = this._storyPoints[_loc1_] as JumpPoint;
            if(this._pointLayer.contains(_loc2_))
            {
               this._pointLayer.removeChild(_loc2_);
            }
            _loc1_++;
         }
         this._storyPointData = new Array();
         this._storyPoints = new Array();
         this._storyPointDict = new Dictionary();
      }
      
      private function removeInteractPoint() : void {
         var _loc2_:JumpPoint = null;
         if(this._interactPoints.length == 0)
         {
            return;
         }
         var _loc1_:* = 0;
         while(_loc1_ < this._interactPoints.length)
         {
            _loc2_ = this._interactPoints[_loc1_] as JumpPoint;
            if(this._pointLayer.contains(_loc2_))
            {
               this._pointLayer.removeChild(_loc2_);
            }
            _loc1_++;
         }
         this._interactPointData = new Array();
         this._interactPoints = new Array();
      }
      
      public function set enabled(param1:Boolean) : void {
         var _loc2_:* = 0;
         var _loc3_:JumpPoint = null;
         this._enabled = param1;
         this._enablePreview = this._enabled;
         this._lineLayer.useHandCursor = this._enabled;
         this._lineLayer.buttonMode = this._enabled;
         this._ball.buttonMode = this._enabled;
         this._ball.useHandCursor = this._enabled;
         this._ballBtn.enabled = this._enabled;
         this._headPoint.button.enabled = this._enabled;
         this._tailPoint.button.enabled = this._enabled;
         if(this._storyPoints.length > 0)
         {
            _loc2_ = 0;
            while(_loc2_ < this._storyPoints.length)
            {
               _loc3_ = this._storyPoints[_loc2_] as JumpPoint;
               _loc3_.button.enabled = this._enabled;
               _loc2_++;
            }
         }
      }
      
      public function get enabled() : Boolean {
         return this._enabled;
      }
      
      public function get enablePreview() : Boolean {
         return this._enablePreview;
      }
      
      public function set enablePreview(param1:Boolean) : void {
         this._enablePreview = param1;
         if(!this._enablePreview)
         {
            dispatchEvent(new ProgressBarEvent(ProgressBarEvent.HIDE_PREVIEW_VIDEO));
            this._isShowingPreview = false;
         }
      }
      
      override public function set width(param1:Number) : void {
         this._width = param1;
         this._unloadBar.width = this._width;
         this._dragW = this._width - this._ball.width;
         this.setPlayPercent(this._playPer);
         this.setLoadPercent(this._loadPer);
         this.layoutADLines();
         this.layoutHeadTail();
         this.layoutStoryPoint();
         this.layoutInteractPoint();
      }
      
      override public function get width() : Number {
         return this._width;
      }
      
      override public function get height() : Number {
         return this._redBar.height;
      }
      
      public function get previewer() : Previewer {
         return this._previewer;
      }
      
      public function showPreview() : void {
         this._previewer.visible = true;
      }
      
      public function hidePreview() : void {
         this._previewer.visible = false;
         this._base.transform.colorTransform = new ColorTransform();
         this._isShowingPreview = false;
      }
      
      public function addADPoints(param1:Array) : void {
         this.removeADPoints();
         if(!this._shouldShowPoint)
         {
            return;
         }
         this._adPoints = param1;
         this.drawADLines();
      }
      
      public function removeADPoints() : void {
         var _loc1_:* = 0;
         while(_loc1_ < this._adLines.length)
         {
            if(this._pointLayer.contains(this._adLines[_loc1_] as DisplayObject))
            {
               this._pointLayer.removeChild(this._adLines[_loc1_] as DisplayObject);
            }
            _loc1_++;
         }
      }
      
      public function get timeOnBar() : Number {
         var _loc1_:Number = Math.round((this._ball.x - this._ball.width / 2) / this._dragW * this.totalTime);
         return _loc1_;
      }
      
      public function set timeOnBar(param1:Number) : void {
         var _loc2_:Number = param1 / this.totalTime;
         if(_loc2_ < 0)
         {
            _loc2_ = 0;
         }
         if(_loc2_ > 1)
         {
            _loc2_ = 1;
         }
         this._ball.x = this._dragW * _loc2_;
      }
      
      public function get hoding() : Boolean {
         return this._hoding;
      }
      
      public function set hoding(param1:Boolean) : void {
         this._hoding = param1;
      }
      
      public function setHead(param1:Number) : void {
         if(param1 == -1)
         {
            return;
         }
         if(!this._shouldShowPoint)
         {
            return;
         }
         this._headPosition = param1 / 1000;
         this._pointLayer.addChild(this._headPoint);
         this._headPoint.x = int(this._dragW * this._headPosition / this.totalTime) + this._ball.width / 2;
         this._headPoint.y = 0;
         this._headPoint.visible = true;
         this.setMode(this._mode,false,true);
      }
      
      public function setTail(param1:Number) : void {
         if(param1 == -1)
         {
            return;
         }
         if(!this._shouldShowPoint)
         {
            return;
         }
         this._tailPosition = param1 / 1000;
         this._pointLayer.addChild(this._tailPoint);
         this._tailPoint.x = int(this._dragW * this._tailPosition / this.totalTime) + this._ball.width / 2;
         this._tailPoint.y = -0.0;
         this._tailPoint.visible = true;
         this.setMode(this._mode,false,true);
      }
      
      public function setStoryPoint(param1:Array) : void {
         var _loc4_:Object = null;
         var _loc5_:JumpPoint = null;
         var _loc6_:* = NaN;
         this.removeStoryPoint();
         if(!this._shouldShowPoint)
         {
            return;
         }
         if(param1 == null || param1.length == 0)
         {
            return;
         }
         var _loc2_:* = 0;
         while(_loc2_ < param1.length)
         {
            _loc4_ = param1[_loc2_];
            if(_loc4_.ctype == "story")
            {
               this._storyPointData.push(_loc4_);
            }
            _loc2_++;
         }
         if(this._storyPointData.length == 0)
         {
            return;
         }
         var _loc3_:* = 0;
         while(_loc3_ < this._storyPointData.length)
         {
            _loc5_ = new JumpPoint();
            _loc6_ = Number(this._storyPointData[_loc3_].startTime) / 1000;
            this._pointLayer.addChild(_loc5_);
            _loc5_.x = int(this._dragW * _loc6_ / this.totalTime) + this._ball.width / 2;
            _loc5_.y = 0;
            _loc5_.visible = true;
            _loc5_.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
            _loc5_.addEventListener(MouseEvent.CLICK,this.onStoryPointEvent);
            this._storyPoints.push(_loc5_);
            this._storyPointDict[_loc5_] = BaseUtil.formatTime(this._storyPointData[_loc3_].startTime / 1000) + " " + this._storyPointData[_loc3_].title;
            _loc3_++;
         }
         this.setMode(this._mode,false,true);
         this.globalEvent = false;
      }
      
      public function setInteractPoint(param1:Array) : void {
         var _loc4_:Object = null;
         var _loc5_:JumpPoint = null;
         var _loc6_:* = NaN;
         this.removeInteractPoint();
         if(!this._shouldShowPoint)
         {
            return;
         }
         if(param1 == null || param1.length == 0)
         {
            return;
         }
         var _loc2_:* = 0;
         while(_loc2_ < param1.length)
         {
            _loc4_ = param1[_loc2_];
            if(_loc4_.ctype == "interact")
            {
               this._interactPointData.push(_loc4_);
            }
            _loc2_++;
         }
         if(this._interactPointData.length == 0)
         {
            return;
         }
         var _loc3_:* = 0;
         while(_loc3_ < this._interactPointData.length)
         {
            _loc5_ = new JumpPoint();
            _loc6_ = Number(this._interactPointData[_loc3_].startTime) / 1000;
            this._pointLayer.addChild(_loc5_);
            _loc5_.x = int(this._dragW * _loc6_ / this.totalTime) + this._ball.width / 2;
            _loc5_.y = 0;
            _loc5_.visible = true;
            _loc5_.addEventListener(MouseEvent.MOUSE_MOVE,this.onThisMouseMove);
            _loc5_.addEventListener(MouseEvent.CLICK,this.onInteractPointEvent);
            this._interactPoints.push(_loc5_);
            this._storyPointDict[_loc5_] = BaseUtil.formatTime(this._interactPointData[_loc3_].startTime / 1000) + " 互动:" + this._interactPointData[_loc3_].title;
            _loc3_++;
         }
         this.setMode(this._mode,false,true);
         this.globalEvent = false;
      }
      
      public function hideAllPoint() : void {
         this._shouldShowPoint = false;
         this.removeADPoints();
         this.removeStoryPoint();
         this.removeInteractPoint();
         if(this._pointLayer.contains(this._headPoint))
         {
            this._pointLayer.removeChild(this._headPoint);
         }
         if(this._pointLayer.contains(this._tailPoint))
         {
            this._pointLayer.removeChild(this._tailPoint);
         }
      }
      
      private function onStoryPointEvent(param1:MouseEvent) : void {
         switch(param1.type)
         {
            case MouseEvent.CLICK:
               this.onLoadBarMouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
               this.onStageMouseUp(new MouseEvent(MouseEvent.MOUSE_UP));
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_STORY_POINT_CLICK);
               break;
         }
      }
      
      private function onInteractPointEvent(param1:MouseEvent) : void {
         switch(param1.type)
         {
            case MouseEvent.CLICK:
               this.onLoadBarMouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
               this.onStageMouseUp(new MouseEvent(MouseEvent.MOUSE_UP));
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_INTERACT_POINT_CLICK);
               break;
         }
      }
      
      private function onHeadEvent(param1:MouseEvent) : void {
         switch(param1.type)
         {
            case MouseEvent.CLICK:
               this.onLoadBarMouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
               this.onStageMouseUp(new MouseEvent(MouseEvent.MOUSE_UP));
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_HEAD_POINT_CLICK);
               break;
         }
      }
      
      private function onTailEvent(param1:MouseEvent) : void {
         switch(param1.type)
         {
            case MouseEvent.CLICK:
               this.onLoadBarMouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
               this.onStageMouseUp(new MouseEvent(MouseEvent.MOUSE_UP));
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_TAIL_POINT_CLICK);
               break;
         }
      }
      
      private function drawADLines() : void {
         var _loc2_:JumpPoint = null;
         var _loc3_:ColorTransform = null;
         var _loc4_:uint = 0;
         this._adLines = [];
         var _loc1_:* = 0;
         while(_loc1_ < this._adPoints.length)
         {
            _loc2_ = new JumpPoint();
            _loc3_ = new ColorTransform();
            _loc4_ = 16750848;
            _loc3_.color = _loc4_;
            _loc2_.transform.colorTransform = _loc3_;
            _loc2_.useHandCursor = true;
            _loc2_.buttonMode = true;
            this._adLines.push(_loc2_);
            this._pointLayer.addChild(_loc2_);
            _loc2_.addEventListener(MouseEvent.ROLL_OVER,this.onADPointEvent);
            _loc2_.addEventListener(MouseEvent.CLICK,this.onADPointEvent);
            _loc1_++;
         }
         if(this._base.contains(this._ball))
         {
            this._base.removeChild(this._ball);
         }
         this._base.addChild(this._ball);
         this.layoutADLines();
      }
      
      private function onADPointEvent(param1:MouseEvent) : void {
         switch(param1.type)
         {
            case MouseEvent.ROLL_OVER:
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_AD_POINT_OVER);
               break;
            case MouseEvent.CLICK:
               this.onLoadBarMouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
               this.onStageMouseUp(new MouseEvent(MouseEvent.MOUSE_UP));
               ReportUtil.sendUserActionLog(ReportUtil.PROGRESS_AD_POINT_CLICK);
               break;
         }
      }
      
      private function layoutADLines() : void {
         var _loc2_:* = NaN;
         var _loc3_:* = NaN;
         var _loc4_:JumpPoint = null;
         var _loc1_:* = 0;
         while(_loc1_ < this._adPoints.length)
         {
            _loc2_ = this._adPoints[_loc1_];
            _loc3_ = int(this._dragW * _loc2_ / this.totalTime) + this._ball.width / 2;
            _loc4_ = this._adLines[_loc1_];
            _loc4_.x = _loc3_;
            _loc1_++;
         }
         this.setMode(this._mode,false,true);
      }
      
      private function layoutHeadTail() : void {
         if(this._headPosition != -1)
         {
            this._headPoint.x = int(this._dragW * this._headPosition / this.totalTime) + this._ball.width / 2;
         }
         if(this._tailPosition != -1)
         {
            this._tailPoint.x = int(this._dragW * this._tailPosition / this.totalTime) + this._ball.width / 2;
         }
      }
      
      private function layoutStoryPoint() : void {
         var _loc2_:JumpPoint = null;
         var _loc3_:* = NaN;
         if(this._storyPoints.length == 0)
         {
            return;
         }
         var _loc1_:* = 0;
         while(_loc1_ < this._storyPoints.length)
         {
            _loc2_ = this._storyPoints[_loc1_] as JumpPoint;
            _loc3_ = Number(this._storyPointData[_loc1_].startTime) / 1000;
            _loc2_.x = int(this._dragW * _loc3_ / this.totalTime) + this._ball.width / 2;
            _loc1_++;
         }
      }
      
      private function layoutInteractPoint() : void {
         var _loc2_:JumpPoint = null;
         var _loc3_:* = NaN;
         if(this._interactPoints.length == 0)
         {
            return;
         }
         var _loc1_:* = 0;
         while(_loc1_ < this._interactPoints.length)
         {
            _loc2_ = this._interactPoints[_loc1_] as JumpPoint;
            _loc3_ = Number(this._interactPointData[_loc1_].startTime) / 1000;
            _loc2_.x = int(this._dragW * _loc3_ / this.totalTime) + this._ball.width / 2;
            _loc1_++;
         }
      }
      
      public function get isImagePreview() : Boolean {
         return this._isImagePreview;
      }
      
      public function set isImagePreview(param1:Boolean) : void {
         this._isImagePreview = param1;
         if(param1)
         {
            this._showPreviewerTimer.delay = 500;
         }
         else
         {
            this._showPreviewerTimer.delay = this.SHOW_PREVIEWER_TIMEOUT;
            this._previewer.isImagePreview = false;
         }
      }
      
      public function setMode(param1:String, param2:Boolean = true, param3:Boolean = false) : void {
         var _loc11_:DisplayObject = null;
         if(param1 == this._mode && !param3)
         {
            return;
         }
         var _loc4_:Number = param2?0.3:0;
         if(this._winType != "interior")
         {
            _loc4_ = 0;
         }
         var _loc5_:Number = 1;
         var _loc6_:Number = 1;
         var _loc7_:Number = 1;
         var _loc8_:Number = 1;
         var _loc9_:Number = 1;
         switch(param1)
         {
            case ControlBarConstant.PROGRESSBAR_MODE_NORMAL:
               _loc5_ = 1;
               _loc6_ = 1;
               _loc7_ = 1;
               _loc8_ = 1;
               _loc9_ = 1;
               break;
            case ControlBarConstant.PROGRESSBAR_MODE_MINI_HIDE_BALL:
               _loc5_ = 0.5;
               _loc6_ = 1;
               _loc7_ = 0;
               _loc8_ = 0;
               _loc9_ = 0;
               break;
            case ControlBarConstant.PROGRESSBAR_MODE_MINI_SHOW_BALL:
               _loc5_ = 0.5;
               _loc6_ = 0.6;
               _loc7_ = 0;
               _loc8_ = 1;
               _loc9_ = 0;
               break;
         }
         this._ball.scaleX = this._ball.scaleY = _loc6_;
         this._loadedBar.x = this._ball.width / 2;
         this._redBar.x = this._loadedBar.x;
         this._redBar_bg.x = 0;
         this._redBar_bg.width = this._redBar.x + 1;
         this._loadedBar_bg.width = this._redBar_bg.width;
         this._loadedBar_bg.x = this._width - this._loadedBar_bg.width;
         Tweener.killTweensOf(this._lineLayer);
         Tweener.killTweensOf(this._ball);
         Tweener.to(this._lineLayer,_loc4_,{"scaleY":_loc5_});
         this._ball.alpha = _loc8_;
         this._ball.y = -this._redBar.height / 2 * _loc5_;
         var _loc10_:* = 0;
         while(_loc10_ < this._pointLayer.numChildren)
         {
            _loc11_ = this._pointLayer.getChildAt(_loc10_);
            Tweener.killTweensOf(_loc11_);
            Tweener.to(_loc11_,0.1,
               {
                  "scaleX":_loc7_,
                  "scaleY":_loc7_,
                  "alpha":_loc9_
               });
            _loc10_++;
         }
         if(this._playPer >= 1)
         {
            this._redBar.width = this._dragW * this._playPer;
            this._ball.x = this._redBar.width + this._ball.width / 2;
         }
         this._mode = param1;
      }
      
      public function set winType(param1:String) : void {
         this._winType = param1;
      }
      
      public function get isShowingPreview() : Boolean {
         return this._isShowingPreview;
      }
      
      public function upDateSkin() : void {
         if(PlayerConfig.rootData.styleid < 2)
         {
            return;
         }
         if(PlayerConfig.partnerData.skinData.status == 0 || !PlayerConfig.partnerData.skinData.isProgressbarDiv)
         {
            return;
         }
         this._unloadBar.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_CACHEDLESS);
         this._loadedBar.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_CACHED);
         this._redBar.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_PLAYED);
         this._redBar_bg.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_PLAYED);
         this._loadedBar_bg.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_CACHED);
         this._ballBtn.filters = PartenerSkinManager.getFilters(PartenerSkinManager.PROGRESSBAR_DOT);
      }
      
      public function clearSkin() : void {
         this._unloadBar.filters = [];
         this._loadedBar.filters = [];
         this._redBar.filters = [];
         this._redBar_bg.filters = [];
         this._loadedBar_bg.filters = [];
         this._ballBtn.filters = [];
      }
   }
}
